package cn.edu.zsc.blms.domain;

import java.util.Comparator;
import java.util.Objects;

/**
 * 实体类基类
 */
public class BaseEntity implements Comparable<BaseEntity> {
    /**
     * ID
     */
    public Integer id;

    public BaseEntity(){

    }

    @Override
    public int compareTo(BaseEntity o){
        return this.id - o.id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        BaseEntity that = (BaseEntity) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    public BaseEntity(int id){
        this.id = id;
    }
}
